const std = @import("std");
const lexer = @import("src/lexer.zig");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();
    const allocator = gpa.allocator();
    
    const source =
        \\import std;
        \\
        \\pub fn main() !void {
        \\    const stdout = std.io.getStdOut().writer();
        \\    try stdout.print("Hello from CZ!\n", .{});
        \\}
    ;
    
    const tokens = try lexer.tokenize(allocator, source);
    defer allocator.free(tokens);
    
    std.debug.print("Total tokens: {d}\n\n", .{tokens.len});
    
    for (tokens, 0..) |token, i| {
        std.debug.print("[{d}] {s:20} '{s}'\n", .{i, @tagName(token.type), token.lexeme});
    }
}
